package com.ag.presentation.businessDelegate;

import com.ag.promanagement.AccionType;
import com.ag.promanagement.CargoType;
import com.ag.promanagement.DocumentType;
import com.ag.promanagement.EstadoType;
import com.ag.promanagement.Process;
import com.ag.promanagement.UserType;
import com.ag.promanagement.Users;
import com.ag.promanagement.control.AccionTypeLogic;
import com.ag.promanagement.control.CargoTypeLogic;
import com.ag.promanagement.control.DocumentTypeLogic;
import com.ag.promanagement.control.EstadoTypeLogic;
import com.ag.promanagement.control.IAccionTypeLogic;
import com.ag.promanagement.control.ICargoTypeLogic;
import com.ag.promanagement.control.IDocumentTypeLogic;
import com.ag.promanagement.control.IEstadoTypeLogic;
import com.ag.promanagement.control.IProcessLogic;
import com.ag.promanagement.control.IUserTypeLogic;
import com.ag.promanagement.control.IUsersLogic;
import com.ag.promanagement.control.ProcessLogic;
import com.ag.promanagement.control.UserTypeLogic;
import com.ag.promanagement.control.UsersLogic;

import java.math.BigDecimal;

import java.util.Date;
import java.util.List;
import java.util.Set;


/**
* Use a Business Delegate to reduce coupling between presentation-tier clients and business services.
* The Business Delegate hides the underlying implementation details of the business service, such as lookup and access details of the EJB architecture.
*
* The Business Delegate acts as a client-side business abstraction; it provides an abstraction for, and thus hides,
* the implementation of the business services. Using a Business Delegate reduces the coupling between presentation-tier clients and
* the system's business services. Depending on the implementation strategy, the Business Delegate may shield clients from possible
* volatility in the implementation of the business service API. Potentially, this reduces the number of changes that must be made to the
* presentation-tier client code when the business service API or its underlying implementation changes.
*
* However, interface methods in the Business Delegate may still require modification if the underlying business service API changes.
* Admittedly, though, it is more likely that changes will be made to the business service rather than to the Business Delegate.
*
* Often, developers are skeptical when a design goal such as abstracting the business layer causes additional upfront work in return
* for future gains. However, using this pattern or its strategies results in only a small amount of additional upfront work and provides
* considerable benefits. The main benefit is hiding the details of the underlying service. For example, the client can become transparent
* to naming and lookup services. The Business Delegate also handles the exceptions from the business services, such as java.rmi.Remote
* exceptions, Java Messages Service (JMS) exceptions and so on. The Business Delegate may intercept such service level exceptions and
* generate application level exceptions instead. Application level exceptions are easier to handle by the clients, and may be user friendly.
* The Business Delegate may also transparently perform any retry or recovery operations necessary in the event of a service failure without
* exposing the client to the problem until it is determined that the problem is not resolvable. These gains present a compelling reason to
* use the pattern.
*
* Another benefit is that the delegate may cache results and references to remote business services. Caching can significantly improve performance,
* because it limits unnecessary and potentially costly round trips over the network.
*
* A Business Delegate uses a component called the Lookup Service. The Lookup Service is responsible for hiding the underlying implementation
* details of the business service lookup code. The Lookup Service may be written as part of the Delegate, but we recommend that it be
* implemented as a separate component, as outlined in the Service Locator pattern (See "Service Locator" on page 368.)
*
* When the Business Delegate is used with a Session Facade, typically there is a one-to-one relationship between the two.
* This one-to-one relationship exists because logic that might have been encapsulated in a Business Delegate relating to its interaction
* with multiple business services (creating a one-to-many relationship) will often be factored back into a Session Facade.
*
* Finally, it should be noted that this pattern could be used to reduce coupling between other tiers, not simply the presentation and the
* business tiers.
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class BusinessDelegatorView {
    private BusinessDelegatorView() {
    }

    public static List<AccionType> getAccionType() throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();

        return accionTypeLogic.getAccionType();
    }

    public static void saveAccionType(Long id, String type)
        throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();
        accionTypeLogic.saveAccionType(id, type);
    }

    public static void deleteAccionType(Long id) throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();
        accionTypeLogic.deleteAccionType(id);
    }

    public static void updateAccionType(Long id, String type)
        throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();
        accionTypeLogic.updateAccionType(id, type);
    }

    public static AccionType getAccionType(Long id) throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();
        AccionType accionType = null;

        try {
            accionType = accionTypeLogic.getAccionType(id);
        } catch (Exception e) {
            throw e;
        }

        return accionType;
    }

    public static List<AccionType> findByCriteriaInAccionType(
        Object[] variables, Object[] variablesBetween,
        Object[] variablesBetweenDates) throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();

        return accionTypeLogic.findByCriteria(variables, variablesBetween,
            variablesBetweenDates);
    }

    public static List<AccionType> findPageAccionType(String sortColumnName,
        boolean sortAscending, int startRow, int maxResults)
        throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();

        return accionTypeLogic.findPageAccionType(sortColumnName,
            sortAscending, startRow, maxResults);
    }

    public static Long findTotalNumberAccionType() throws Exception {
        IAccionTypeLogic accionTypeLogic = new AccionTypeLogic();

        return accionTypeLogic.findTotalNumberAccionType();
    }

    public static List<CargoType> getCargoType() throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();

        return cargoTypeLogic.getCargoType();
    }

    public static void saveCargoType(Long id, String type)
        throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();
        cargoTypeLogic.saveCargoType(id, type);
    }

    public static void deleteCargoType(Long id) throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();
        cargoTypeLogic.deleteCargoType(id);
    }

    public static void updateCargoType(Long id, String type)
        throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();
        cargoTypeLogic.updateCargoType(id, type);
    }

    public static CargoType getCargoType(Long id) throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();
        CargoType cargoType = null;

        try {
            cargoType = cargoTypeLogic.getCargoType(id);
        } catch (Exception e) {
            throw e;
        }

        return cargoType;
    }

    public static List<CargoType> findByCriteriaInCargoType(
        Object[] variables, Object[] variablesBetween,
        Object[] variablesBetweenDates) throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();

        return cargoTypeLogic.findByCriteria(variables, variablesBetween,
            variablesBetweenDates);
    }

    public static List<CargoType> findPageCargoType(String sortColumnName,
        boolean sortAscending, int startRow, int maxResults)
        throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();

        return cargoTypeLogic.findPageCargoType(sortColumnName, sortAscending,
            startRow, maxResults);
    }

    public static Long findTotalNumberCargoType() throws Exception {
        ICargoTypeLogic cargoTypeLogic = new CargoTypeLogic();

        return cargoTypeLogic.findTotalNumberCargoType();
    }

    public static List<DocumentType> getDocumentType()
        throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();

        return documentTypeLogic.getDocumentType();
    }

    public static void saveDocumentType(Long id, String type)
        throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();
        documentTypeLogic.saveDocumentType(id, type);
    }

    public static void deleteDocumentType(Long id) throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();
        documentTypeLogic.deleteDocumentType(id);
    }

    public static void updateDocumentType(Long id, String type)
        throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();
        documentTypeLogic.updateDocumentType(id, type);
    }

    public static DocumentType getDocumentType(Long id)
        throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();
        DocumentType documentType = null;

        try {
            documentType = documentTypeLogic.getDocumentType(id);
        } catch (Exception e) {
            throw e;
        }

        return documentType;
    }

    public static List<DocumentType> findByCriteriaInDocumentType(
        Object[] variables, Object[] variablesBetween,
        Object[] variablesBetweenDates) throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();

        return documentTypeLogic.findByCriteria(variables, variablesBetween,
            variablesBetweenDates);
    }

    public static List<DocumentType> findPageDocumentType(
        String sortColumnName, boolean sortAscending, int startRow,
        int maxResults) throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();

        return documentTypeLogic.findPageDocumentType(sortColumnName,
            sortAscending, startRow, maxResults);
    }

    public static Long findTotalNumberDocumentType() throws Exception {
        IDocumentTypeLogic documentTypeLogic = new DocumentTypeLogic();

        return documentTypeLogic.findTotalNumberDocumentType();
    }

    public static List<EstadoType> getEstadoType() throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();

        return estadoTypeLogic.getEstadoType();
    }

    public static void saveEstadoType(Long id, String type)
        throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();
        estadoTypeLogic.saveEstadoType(id, type);
    }

    public static void deleteEstadoType(Long id) throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();
        estadoTypeLogic.deleteEstadoType(id);
    }

    public static void updateEstadoType(Long id, String type)
        throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();
        estadoTypeLogic.updateEstadoType(id, type);
    }

    public static EstadoType getEstadoType(Long id) throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();
        EstadoType estadoType = null;

        try {
            estadoType = estadoTypeLogic.getEstadoType(id);
        } catch (Exception e) {
            throw e;
        }

        return estadoType;
    }

    public static List<EstadoType> findByCriteriaInEstadoType(
        Object[] variables, Object[] variablesBetween,
        Object[] variablesBetweenDates) throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();

        return estadoTypeLogic.findByCriteria(variables, variablesBetween,
            variablesBetweenDates);
    }

    public static List<EstadoType> findPageEstadoType(String sortColumnName,
        boolean sortAscending, int startRow, int maxResults)
        throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();

        return estadoTypeLogic.findPageEstadoType(sortColumnName,
            sortAscending, startRow, maxResults);
    }

    public static Long findTotalNumberEstadoType() throws Exception {
        IEstadoTypeLogic estadoTypeLogic = new EstadoTypeLogic();

        return estadoTypeLogic.findTotalNumberEstadoType();
    }

    public static List<Process> getProcess() throws Exception {
        IProcessLogic processLogic = new ProcessLogic();

        return processLogic.getProcess();
    }

    public static void saveProcess(String accionado, String accionante,
        Long docAdjunto, Date fechaIngreso, Date fechaRadicacion, Long id,
        Long id_AccionType, Long id_EstadoType, Long id_Users)
        throws Exception {
        IProcessLogic processLogic = new ProcessLogic();
        processLogic.saveProcess(accionado, accionante, docAdjunto,
            fechaIngreso, fechaRadicacion, id, id_AccionType, id_EstadoType,
            id_Users);
    }

    public static void deleteProcess(Long id) throws Exception {
        IProcessLogic processLogic = new ProcessLogic();
        processLogic.deleteProcess(id);
    }

    public static void updateProcess(String accionado, String accionante,
        Long docAdjunto, Date fechaIngreso, Date fechaRadicacion, Long id,
        Long id_AccionType, Long id_EstadoType, Long id_Users)
        throws Exception {
        IProcessLogic processLogic = new ProcessLogic();
        processLogic.updateProcess(accionado, accionante, docAdjunto,
            fechaIngreso, fechaRadicacion, id, id_AccionType, id_EstadoType,
            id_Users);
    }

    public static Process getProcess(Long id) throws Exception {
        IProcessLogic processLogic = new ProcessLogic();
        Process process = null;

        try {
            process = processLogic.getProcess(id);
        } catch (Exception e) {
            throw e;
        }

        return process;
    }

    public static List<Process> findByCriteriaInProcess(Object[] variables,
        Object[] variablesBetween, Object[] variablesBetweenDates)
        throws Exception {
        IProcessLogic processLogic = new ProcessLogic();

        return processLogic.findByCriteria(variables, variablesBetween,
            variablesBetweenDates);
    }

    public static List<Process> findPageProcess(String sortColumnName,
        boolean sortAscending, int startRow, int maxResults)
        throws Exception {
        IProcessLogic processLogic = new ProcessLogic();

        return processLogic.findPageProcess(sortColumnName, sortAscending,
            startRow, maxResults);
    }

    public static Long findTotalNumberProcess() throws Exception {
        IProcessLogic processLogic = new ProcessLogic();

        return processLogic.findTotalNumberProcess();
    }

    public static List<Users> getUsers() throws Exception {
        IUsersLogic usersLogic = new UsersLogic();

        return usersLogic.getUsers();
    }

    public static void saveUsers(Long cellNumber, Long documentId,
        String email, String firstName, Long id, String lastName, String login,
        String password, Long id_CargoType, Long id_DocumentType,
        Long id_UserType) throws Exception {
        IUsersLogic usersLogic = new UsersLogic();
        usersLogic.saveUsers(cellNumber, documentId, email, firstName, id,
            lastName, login, password, id_CargoType, id_DocumentType,
            id_UserType);
    }

    public static void deleteUsers(Long id) throws Exception {
        IUsersLogic usersLogic = new UsersLogic();
        usersLogic.deleteUsers(id);
    }

    public static void updateUsers(Long cellNumber, Long documentId,
        String email, String firstName, Long id, String lastName, String login,
        String password, Long id_CargoType, Long id_DocumentType,
        Long id_UserType) throws Exception {
        IUsersLogic usersLogic = new UsersLogic();
        usersLogic.updateUsers(cellNumber, documentId, email, firstName, id,
            lastName, login, password, id_CargoType, id_DocumentType,
            id_UserType);
    }

    public static Users getUsers(Long id) throws Exception {
        IUsersLogic usersLogic = new UsersLogic();
        Users users = null;

        try {
            users = usersLogic.getUsers(id);
        } catch (Exception e) {
            throw e;
        }

        return users;
    }

    public static List<Users> findByCriteriaInUsers(Object[] variables,
        Object[] variablesBetween, Object[] variablesBetweenDates)
        throws Exception {
        IUsersLogic usersLogic = new UsersLogic();

        return usersLogic.findByCriteria(variables, variablesBetween,
            variablesBetweenDates);
    }

    public static List<Users> findPageUsers(String sortColumnName,
        boolean sortAscending, int startRow, int maxResults)
        throws Exception {
        IUsersLogic usersLogic = new UsersLogic();

        return usersLogic.findPageUsers(sortColumnName, sortAscending,
            startRow, maxResults);
    }

    public static Long findTotalNumberUsers() throws Exception {
        IUsersLogic usersLogic = new UsersLogic();

        return usersLogic.findTotalNumberUsers();
    }

    public static List<UserType> getUserType() throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();

        return userTypeLogic.getUserType();
    }

    public static void saveUserType(Long id, String type)
        throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();
        userTypeLogic.saveUserType(id, type);
    }

    public static void deleteUserType(Long id) throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();
        userTypeLogic.deleteUserType(id);
    }

    public static void updateUserType(Long id, String type)
        throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();
        userTypeLogic.updateUserType(id, type);
    }

    public static UserType getUserType(Long id) throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();
        UserType userType = null;

        try {
            userType = userTypeLogic.getUserType(id);
        } catch (Exception e) {
            throw e;
        }

        return userType;
    }

    public static List<UserType> findByCriteriaInUserType(Object[] variables,
        Object[] variablesBetween, Object[] variablesBetweenDates)
        throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();

        return userTypeLogic.findByCriteria(variables, variablesBetween,
            variablesBetweenDates);
    }

    public static List<UserType> findPageUserType(String sortColumnName,
        boolean sortAscending, int startRow, int maxResults)
        throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();

        return userTypeLogic.findPageUserType(sortColumnName, sortAscending,
            startRow, maxResults);
    }

    public static Long findTotalNumberUserType() throws Exception {
        IUserTypeLogic userTypeLogic = new UserTypeLogic();

        return userTypeLogic.findTotalNumberUserType();
    }
}
